<extend name="base/Base" />
<block name="Style">
<!-- FooTable Plugin CSS -->
		<link rel="stylesheet" type="text/css" href="__ABSOLUTEADMIN__/vendor/plugins/footable/css/footable.core.min.css">
		<!-- Admin Forms CSS -->
		<link rel="stylesheet" type="text/css" href="__ABSOLUTEADMIN__/assets/admin-tools/admin-forms/css/admin-forms.css">

		<js href="__ADDON__/ueditor/js/jquery-1.11.0.min.js" />
		<js href="__ADDON__/ueditor/cms.admin.config.js" />    
		<js href="__ADDON__/ueditor/ueditor.all.min.js" />
		<link rel="stylesheet" href="/public/addon/style/css/bootstrap-select.css">
		<script src="/public/addon/style/js/bootstrap-select.min.js"></script>
		<script>
		$(function(){
			var url="__APP__/Home/Ueditor/Index/Addon/Ueditor.html";
			var ue = UE.getEditor('container',{
				serverUrl :url,
				UEDITOR_HOME_URL:'__ADDON__/ueditor/',
			});
			

			ue.ready(function(){
				ue.execCommand('serverparam', {
					'uid': "<?php echo getUID(); ?>",
				   'username': '<?php echo getUID(); ?>',
				});
			});
		})
		</script>
		<style>
			.col-md-4{
				
			}
		</style>
		<js href="__ADDON__/ajaxupload/js/jquery.js" />
		<js href="__ADDON__/ajaxupload/js/ajaxupload.js" />
		<script type="text/javascript">
		$(function(){
			var button = $('#upload_button'), interval;
			var confirmdiv = $('#uploadphotoconfirm');
			var fileType = "pic",fileNum = "one"; 
			new AjaxUpload(button,{
				action: "__APP__/Home/Upload/Image/Addon/AjaxUpload.html",
				name: 'userfile',
				onSubmit : function(file, ext){
					if(fileType == "pic")
					{
						if (ext && /^(jpg|png|jpeg|gif|JPG)$/.test(ext)){
							this.setData({
								'info': '文件类型为图片'
							});
						} else {
							 confirmdiv.text('文件格式错误，请上传格式为.png .jpg .jpeg 的图片');
							return false;               
						}
					}
								
					confirmdiv.text('文件上传中');
					
					if(fileNum == 'one')
						this.disable();
					
					interval = window.setInterval(function(){
						var text = confirmdiv.text();
						if (text.length < 14){
							confirmdiv.text(text + '.');                    
						} else {
							confirmdiv.text('文件上传中');             
						}
					}, 200);
				},
				onComplete: function(file, response){
					if(response != "success"){
						if(response =='2'){
							confirmdiv.text("文件格式错误，请上传格式为.png .jpg .jpeg 的图片");
						}else{
							
							confirmdiv.text("上传完成");
							
							$("#newbikephotoName").val(response);
							$("#newbikephoto").attr("src",response);	
							$("#imgurl").attr("value",response);						
							
						}
						
					}
										  
					window.clearInterval(interval);
								
					this.enable();
					
					if(response == "success")
					alert('上传成功');              
				}
			});
		});
		</script>

</block>
<block name="Topbar">
								
 <!-- Start: Topbar -->
      <header id="topbar" class="ph10">
        <div class="topbar-left">
         <ul class="nav nav-list nav-list-topbar pull-left">
           <li>
              <a  href="__APP__/Mall/User/activity.html">活动列表</a>
            </li>
			<li class="active">
              <a href="#">编辑活动</a>
            </li>
			<!--  -->
			
           
          </ul>
        </div>
      </header>
	  						
    				
</block>
<block name="Content">

<!-- START ROW -->

	<div class="row">

		<!-- NEW COL START -->
		<article class="col-md-offset-1 col-sm-12 col-md-12 col-lg-10">
			
			<!-- Widget ID (each widget will need unique ID)-->
			<div class="jarviswidget" id="wid-id-7" data-widget-editbutton="false" data-widget-custombutton="false">
				
				<!-- widget div-->
				<div>
					<!-- widget edit box -->
					<div class="jarviswidget-editbox">
						<!-- This area used as dropdown edit box -->
						
					</div>
					<!-- end widget edit box -->
					
					<!-- widget content -->
					<div class="widget-body no-padding">
						
						<form id="smart-form-register" action="__APP__/Mall/User/Edit_activity.html"  enctype="multipart/form-data" method="post" class="smart-form">
							
							<input type='hidden' name="id" value="{$data.id}"/>
							 <div class="row">
								 <div class="col-md-4">
									 <div class="form-group">
										<label for="exampleInputEmail1">请输入活动标题</label>
										<input type="text"  name="name" id="name" class="form-control"  placeholder="请输入活动标题" value="{$data.name}">
									  </div>
								  </div>
								  
								 <div class="col-md-4">
									 <div class="form-group">
										<label for="exampleInputEmail1">请输入活动地点</label>
										<input type="text"  name="address" id="address" class="form-control"  placeholder="请输入活动地点" value="{$data.address}">
									  </div>
								  </div>
								  
								   <div class="col-md-4">
								  <div class="form-group">
									<label for="exampleInputEmail1">请选择流派风格</label>
									 <select id="style" name="style[]" class="selectpicker show-tick form-control" multiple data-live-search="false">
										<volist name="style_list" id="style_list">
											<if condition="$style_list['if'] eq 1">
											<option value ="{$style_list.id}" selected="selected">{$style_list.name}</option>
											<else/>
											<option value ="{$style_list.id}">{$style_list.name}</option>
											</if>
										</volist>
									</select>
								  </div>
								  </div>
								  <div class="col-md-4">
								  <div class="form-group">
								<label for="exampleInputEmail1">请选择活动时间</label>
								<input style="height:38px;" name="release_time" placeholder="请输入日期" value='{$data.release_time|date="Y-m-d",###}' class="form-control laydate-icon gui-input" onclick="laydate()">
								</div>
								</div>
								  
								<!-- <div class="col-md-4">
								   <div class="form-group">
									<label for="exampleInputEmail1">请输入票价</label>
									<input type="text"  name="money" id="money" class="form-control"  placeholder="请输入票价" value="{$data.money}">
								  </div>
							  </div> -->
								
								<br/><br/><br/><br/><br/><br/><br/><br/><br/>
								<div class='row'>
								  <div class="col-md-3">
							   <section>
						<label class="control-label" for="bike_type">&nbsp;</label>
							<input type="file" style="display:none" name="userfile">
							<input type="hidden" id="newbikephotoName" name="img" value="{$data.img}" />
							<input type="hidden" id="oldbikephotoName" value="{$data.img}" />
							<div class="controls" style="text-align:center;">
								<img  id="newbikephoto" src="{$data.img}" style="max-height:200px;max-width:200px;" />
								<span class="help-inline"></span>
								<br/>
								<div id="uploadphotoconfirm"></div>
								<br/>
								<input type="hidden" name="img" id="imgurl" value="{$data.img}" style="max-height:200px;max-width:200px;"  >
								<input type="button" class="btn btn-lg btn-primary" style="width:50%" id="upload_button"  value="上传封面图" /><br/>
							</div>
							</section>
							</div>
							<a href="__APP__/Mall/Classify/zip_log/form_id/{$data.id}/type/5.html"  target="_blank">
							<!-- <div class="col-md-3">
								<div class='controls' style='text-align:center;'>
									<br/>
									<div style='height:40px;margin:auto;line-height:40px;' id="fileView"></div>
									<br/>
									<input type="button" class="btn btn-lg btn-primary" style="width:50%" id="btn1"  value="编辑活动图" /><br/>
								</div>
							</div> -->
							</a>
								</div>
							
								<br/>
								<br/>
<script>
								btn1.onclick = function(){
									var ie=navigator.appName=="Microsoft Internet Explorer" ? true : false; 
								　　if(ie){ 
								　　　　document.getElementById("file").click(); 
								　　}else{
								　　　　var a=document.createEvent("MouseEvents");//FF的处理 
								　　　　a.initEvent("click", true, true);  
								　　　　color_img.dispatchEvent(a); 
								　　} 
								
								color_img.onchange = function(){
									if(this.files[0]){
										fileView.innerHTML = '已选'+this.files.length+'个图片'
									}
								}
								}
								
								btn2.onclick = function(){
									var ie=navigator.appName=="Microsoft Internet Explorer" ? true : false; 
								　　if(ie){ 
								　　　　document.getElementById("file").click(); 
								　　}else{
								　　　　var a=document.createEvent("MouseEvents");//FF的处理 
								　　　　a.initEvent("click", true, true);  
								　　　　foil_img.dispatchEvent(a); 
								　　} 
								
								foil_img.onchange = function(){
									if(this.files[0]){
										fileView1.innerHTML = '已选'+this.files.length+'个图片'
									}
								}
								}
							</script>
<!--Author:DCL-->
<style>
	#oList b{
		float:left;
	}
	#oList>p{
		overflow:hidden;
	}
	#oList span{
		float:left;
		width:18%;
	}
	#oList span:last-of-type{
		float:right;
		width:6%;
		cursor:pointer;
	}
</style>

<div id='iBox'>
	<div class="row" >
		<div class="col-md-4">
			<div class="form-group">
				<label for="exampleInputEmail1">请选择购票开始时间</label>
				<input style="height:38px;" id='startT' name="" placeholder="请输入日期" value='' class="form-control laydate-icon gui-input" onclick="laydate()">
			</div>
		</div>
		<div class="col-md-4">
			<div class="form-group">
				<label for="exampleInputEmail1">请选择购票结束时间</label>
				<input style="height:38px;" id = 'endT' name="" placeholder="请输入日期" value='' class="form-control laydate-icon gui-input" onclick="laydate()">
			</div>
		</div>
	</div>
	<div class="row">
		<div class="col-md-4">
			<div class="form-group">
			<label for="exampleInputEmail1">请输入票价</label>
			<input type="text"  name="" id = 'whoMoney' class="form-control"  placeholder="请输入票价">
			</div>
		</div>
		<div class="col-md-4">
			<div class="form-group">
			<label for="exampleInputEmail1">请输入票价名称</label>
			<input type="text"  name="" id='whoName' class="form-control"  placeholder="请输入票价名称">
			</div>
		</div>
		<div class="col-md-4">
			<div class="form-group">
			<label for="exampleInputEmail1">请输入票数</label>
			<input type="text"  name="" id='whoNumber' class="form-control"  placeholder="请输入票数">
			</div>
		</div>
	</div> 
<button type = 'button' id='btn'>确认提交</button>
<br/>
<br/>
</div>
<div id='oList'>
	<volist name="money_list" id="money_list" key="k">
	<p>
		<b class='num'>{$k}.</b>
		<span>购票开始时间：{$money_list.begin_time|date="Y-m-d H:i",###}</span>
		<span>购票结束时间：{$money_list.end_time|date="Y-m-d H:i",###}</span>
		<span>票价：{$money_list.goods_money}</span>
		<span>名称：{$money_list.name}</span>
		<span>票数：{$money_list.number}</span>
		<span class="del m_d{$k}" onclick="delete_money({$money_list.id},{$k})">删除</span>
	</p>
	</volist>
</div>
<br/>
<br/>
<script>
var num,del
	btn.onclick = function(){
		if(startT.value&& endT.value&& whoMoney.value&& whoName.value&& whoNumber){
			oList.innerHTML+="<p><b class='num'></b><span>购票开始时间："+startT.value+"<input type='hidden' name='huodong_begin[]' value = '"+startT.value+"'></span><span>购票结束时间："+endT.value+"<input type='hidden' name='huodong_end[]' value = '"+endT.value+"'></span><span>票价："+whoMoney.value+"<input type='hidden' name='huodong_money[]' value = '"+whoMoney.value+"'></span><span>名称："+whoName.value+"<input type='hidden' name='huodong_name[]' value = '"+whoName.value+"'></span><span>票数:"+whoNumber.value+"<input type='hidden' name='number[]' value = '"+whoNumber.value+"'></span><span class='del'>删除</span></p>"
			startT.value = '';
			endT.value= '';
			whoMoney.value = '';
			whoName.value = '';
			num = document.getElementsByClassName('num')
			for(i in num){
				num[i].innerHTML = Number(i)+1+'.';
			}
			del = document.getElementsByClassName('del')
			for(i in del){
				del[i].onclick = function(){
				console.log('dd')
				this.parentNode.parentNode.removeChild(this.parentNode)
				num = document.getElementsByClassName('num')
				for(i in num){
					num[i].innerHTML = Number(i)+1+'.';
				}
		}
			}
		}
	}
	//del = document.getElementsByClassName('del')
	//for(i in del){
			//	del[i].onclick = function(){
			//	console.log('dd')
			//	this.parentNode.parentNode.removeChild(this.parentNode)
			//	num = document.getElementsByClassName('num')
			//	for(i in num){
			//		num[i].innerHTML = Number(i)+1+'.';
			//	}
		//}
		//	}
</script>
<!--Author:DCL-->	
								<section>
									<label for="exampleInputEmail1">请输入活动详情</label>
									
									<label class="input">
									 <script id="container" name="value" type="text/plain">{$data.value}</script>
									 </label>
								</section>
								
							</fieldset>
							<br>
							<footer>
								<button type="submit" class="btn btn-primary" style="width:100%">
									确认编辑
								</button>
							</footer>

						</form>						
						
					</div>
					<!-- end widget content -->

				</div>
				<!-- end widget div -->
				
			</div>
			<!-- end widget -->	

		</article>
		<!-- END COL -->

		
	<br>
	<br>
	</div>

	<!-- END ROW -->

</block>
<block name="Script">
	
  <!-- FooTable Plugin -->
  <script src="__ABSOLUTEADMIN__/vendor/plugins/footable/js/footable.all.min.js"></script>
   <!-- FooTable Addon -->
  <script src="__ABSOLUTEADMIN__/vendor/plugins/footable/js/footable.filter.min.js"></script>

						<script>
						
							//新增配置
							//新增配置
							function change(){  
							
								var username = $("#username").val();
								var nickname = $("#nickname").val();
								
								var tel = $("#tel").val();
								var email = $("#email").val();
								var img = $("#newbikephotoName").val();
								
								$.ajax({
									type:'POST',
									url:"__APP__/Admin/User/Create.html",
									data:{
										
										"username": username,
										"nickname": nickname,
										"tel": tel,
										"email": email,
										"img": img,
										
										
									},
									success:function(data){			
										var info = eval(data)
										if (info.errcode == 0) {
										
											layer.msg(info.errmsg);
											setTimeout(window.location.reload(),3000);
											
										}else{
											layer.msg(info.errmsg);
										}
									},
									error:function(){
										layer.msg('系统繁忙,请稍候重试！');
									}
								
								});	 
							} 
						//新增配置
							function delete_money(id,k){ 
								$.ajax({
									type:'POST',
									url:"__APP__/Mall/Page/delete_money.html",
									data:{
										"id": id,
									},
									success:function(data){			
										var info = eval(data)
										if (info.errcode == 0) {
										
											layer.msg(info.errmsg);
											
											del = document.getElementsByClassName('m_d'+k)
											console.log(del[0].parentNode)
												del[0].parentNode.parentNode.removeChild(del[0].parentNode)
												num = document.getElementsByClassName('num')
												for(i in num){
													num[i].innerHTML = Number(i)+1+'.';
												}
											
										}else{
											layer.msg(info.errmsg);
										}
									},
									error:function(){
										layer.msg('系统繁忙,请稍候重试！');
									}
								
								});	 
							}  

							
							</script>
 <script type="text/javascript">
  jQuery(document).ready(function() {

 

    // Init FooTable Examples
    $('.footable').footable();


  });
  </script>
</block>